pp108 : collapseAll Method

collapseAll Method


This method collapses the root node or the selected node of the tree to all levels recursively.

Syntax

treeID.root.collapseAll()

When called from a node other than root, the syntax is as follows:
treeNode.collapseAll()

Return Value

No return value.

Remarks

The operation should be performed only on a parent tree node item that is already expanded (item with a "-" symbol before it indicating that it is already expanded).

When this function is called, the node is collapsed to all the levels recursively, and any function associated with the oncollapse property of the tree item is fired for each item. Once collapsed, all the collapsed items will have a "+" symbol in place of "-" indicating that they are already collapsed.

collapseAll can be called on the root, only if there is a root in the tree (Root property).

Example

The following example shows how the above method is defined.

//Function called on onload event of the window
function initialize()
{
    //Expand all nodes
    if (sampletree.root)
    {
        sampletree.root.expandAll();
        //Alert
        application.notify('All nodes expanded');
        //Collapse all nodes
        sampletree.root.collapseAll();
    }
}

See Also

tree, oncollapse